<div class="form-group">
    <label class="col-sm-{$wconfig.title_col} control-label">{$wconfig.title}</label>
    <div class="col-sm-{$wconfig.content_col}">
        <div class="input-group">
            <input class="form-control" name="{$wconfig.name}" value="{$wconfig.widget_val}" placeholder="{$wconfig.placeholder}" {$wconfig.readonly} {$wconfig.disabled} >
            <span class="input-group-btn">
                {if $wconfig['type'] == 'image'}
                <a href="{$wconfig.widget_val_img}" target="_blank" >
                    <img src="{$wconfig.widget_val_img}" style="height:34px; width:68px;" />
                </a>
                {/if}
                <button class="btn btn-success btn-flat kindeditor_{$wconfig.name}" type="button" {$wconfig.btn_disabled} >
                    <i class="fa fa-cloud-upload"> {:lang('upload')}</i>
                </button>
            </span>
        </div>
    </div>
    <div class="col-sm-{$wconfig.validate_col}">
        <span class="help-block">{$wconfig.validate}</span>
    </div>
</div>
<script>
var KDEDT_DELETE_URL = '{:url("Uploads/delete")}';   //【删除地址】如果有使用到KindEditor编辑器的文件空间删除功能，必须添加该删除地址全局变量
$(function(){
    var editor_{$wconfig.name} = KindEditor.editor({
        allowFileManager : true,                        //允许对上传图片进行管理
        uploadJson : '{:url("Uploads/upload")}',        //文件上传地址
        fileManagerJson : '{:url("Uploads/manager")}',  //文件管理地址
    });
    {if $wconfig['type'] == 'image'}
    $('body').off('click', '.kindeditor_{$wconfig.name}');
    $('body').on('click', '.kindeditor_{$wconfig.name}', function(event){
        var _this = $(this);
        editor_{$wconfig.name}.loadPlugin('image', function() {
            editor_{$wconfig.name}.plugin.imageDialog({
                imageUrl : _this.parent().prev().val(),
                clickFn : function(url, title, width, height, border, align) {
                    _this.parent().prev().val(url);
                    _this.prev().attr('href', url);
                    _this.prev().find('img').attr('src', url);
                    editor_{$wconfig.name}.hideDialog();
                }
            });
        });
    });
    {else /}
    $('body').off('click', '.kindeditor_{$wconfig.name}');
    $('body').on('click', '.kindeditor_{$wconfig.name}', function(event){
        var _this = $(this);
        editor_{$wconfig.name}.loadPlugin('insert{$wconfig.type}', function() {
            editor_{$wconfig.name}.plugin.fileDialog({
                fileUrl : _this.parent().prev().val(),
                clickFn : function(url, title) {
                    _this.parent().prev().val(url);
                    editor_{$wconfig.name}.hideDialog();
                }
            });
        });
    });
    {/if}
})
</script>